package com.cambright.stack.components
{
	import com.cambright.lotusroot.Command;
	
	import flash.events.MouseEvent;
	
	public class ButtonComponent extends ControlComponent
	{
		public var clickCommand:Class;
		
		override protected function dispose():void
		{
			clickCommand = null;
			super.disable();
		}
		
		override protected function enable():void
		{
			super.enable();
			target.addEventListener(MouseEvent.CLICK, _onClick);
		}
		
		override protected function disable():void
		{
			target.removeEventListener(MouseEvent.CLICK, _onClick);
			super.disable();
		}
		
		private function _onClick(event:MouseEvent):void
		{
			var click:Command = new clickCommand();
			click.dispatch();
		}
	}
}